home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / Blitting Class Library / Blitting Headers / MMUModeSwapper.h < prev    next >
Encoding:
Text File  |  1995-10-29  |  737 b   |  33 lines  |  [TEXT/CWIE]

  1. // MMUModeSwapper.h, an MMU Mode swapper using the "resource acquisition
  2. //    is initialization" technique, see 9.4 of Stroustrup.
  3.  
  4. // copyright © 1995, Macneil Shonle. All rights reserved.
  5.  
  6. #ifndef __MMUMODESWAPPER__
  7. #define __MMUMODESWAPPER__
  8.  
  9.         // class MMUModeSwapper
  10. class MMUModeSwapper {
  11. public:
  12.     MMUModeSwapper(int swapTo32);
  13.     ~MMUModeSwapper();
  14.  
  15. private:
  16.     int into32;
  17.     SInt8 mode;
  18. };
  19.  
  20. // swaps into 32-bit addressing if swapTo32 is true, else keeps the same addressing-mode
  21. inline MMUModeSwapper::MMUModeSwapper(int swapTo32)
  22.     : into32(swapTo32), mode(true32b)
  23. {
  24.     if (into32) SwapMMUMode(&mode);
  25. }
  26.  
  27. // swaps back to the original addressing mode
  28. inline MMUModeSwapper::~MMUModeSwapper()
  29. {
  30.     if (into32) SwapMMUMode(&mode);
  31. }
  32.  
  33. #endif